using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;

public class SideSwitch : MonoBehaviour
{

    private Vector3 srcPos;

    private RectTransform rect;

    public float targetPosX = -480f;

    private bool open = false;

    void Start()
    {
        rect = GetComponent<RectTransform>();
        srcPos = rect.position;

    }


    void Update()
    {
        
    }


    public void Hide() {
        rect.DOMoveX(srcPos.x, 0.5f);
    }


    public void Show() {
        rect.DOMoveX(targetPosX, 0.5f);
    }


    public void OpenBtn() {
        if (open)
        {
            Hide();
        }
        else
        {
            Show();
        }
        open = !open;
    }
}
